package com.yonyou.cyxdms.basedata.service.repository.code;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yonyou.cyx.framework.dao.base.SuperMapper;
import com.yonyou.cyxdms.basedata.client.domains.vo.CodeVO;
import com.yonyou.cyxdms.basedata.client.dto.code.CodeDTO;
import com.yonyou.cyxdms.basedata.client.dto.code.SearchCodeDTO;
import com.yonyou.cyxdms.basedata.service.entity.code.CodePO;
import com.yonyou.cyxdms.framework.bean.dto.user_info.LoginInfoDto;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 系统固定代码 Mapper 接口
 * </p>
 *
 * @author maxingjian
 * @since 2018-12-12
 */
@Repository
public interface CodeMapper extends SuperMapper<CodePO> {

    List<CodeVO> queryTcCodeListByType(@Param("params") Map<String, Object> queryParam);

    List<CodeVO> queryTcCodeList(@Param("appId") String appId);

    /**
     * 根据Type获取下一个codeId
     * @param type
     * @return
     */
    Integer getNextCodeId(Integer type,String appId);

    /**
     * 根据Type获取下一个num
     * @param type
     * @param appId
     * @return
     */
    Integer getNextNum(Integer type, String appId);

    /**
     * 根据codeId查询
     *
     * @param codeId
     * @param appId
     * @return com.yonyou.cyxdms.basedata.client.domains.vo.CodeVO
     * @author dengqiang
     * @since 2019/11/1
     */
    CodeVO queryByCodeId(@Param("codeId")Long codeId, @Param("appId")String appId);



    List<CodeDTO> queryList(Page page, @Param("params") SearchCodeDTO dto, @Param("loginInfo") LoginInfoDto loginInfo);

    List<CodeDTO> getAllCodeType(@Param("typeName")String typeName,@Param("loginInfo") LoginInfoDto loginInfo);

    CodeDTO getCodeById(@Param("codeId")Integer codeId,@Param("loginInfo") LoginInfoDto loginInfo);

    int insertCode(@Param("dto") CodeDTO dto, @Param("loginInfo") LoginInfoDto loginInfo);

    int upadteCode(@Param("dto") CodeDTO dto, @Param("loginInfo") LoginInfoDto loginInfo);

    String getTypeNameByType(@Param("type")Integer type, @Param("loginInfo") LoginInfoDto loginInfo);
}
